/* 🎨 现代化工具选择器样式 */

.tool-category-selector {
  position: relative;
  width: 100%;
  min-width: 240px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 🎯 主选择器样式 */
.modern-selector {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.modern-selector:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modern-selector.open {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.selector-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
}

.selected-display {
  flex: 1;
  min-width: 0;
}

.selected-tool {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selected-tool .tool-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.selected-tool .tool-name {
  font-weight: 500;
  color: #1e293b;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-tool .tool-source {
  font-size: 11px;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.placeholder {
  color: #94a3b8;
  font-style: italic;
}

.selector-arrow {
  color: #64748b;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
}

.modern-selector.open .selector-arrow {
  transform: rotate(180deg);
}

/* 🎨 现代下拉框样式 */
.modern-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  max-height: 420px;
  overflow: hidden;
  width: 350px;
  animation: dropdownSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 🔍 搜索框样式 */
.search-section {
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: #64748b;
  z-index: 1;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  background: #ffffff;
  transition: all 0.2s ease;
  outline: none;
}

.search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
  color: #94a3b8;
}

.clear-search {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 18px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.clear-search:hover {
  background: #f1f5f9;
  color: #475569;
}

/* 🗂️ 分类网格样式 */
.categories-section {
  max-height: 300px;
  overflow-y: auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.section-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.total-count {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.back-button {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.back-button:hover {
  background: #eff6ff;
  color: #2563eb;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--category-color, #3b82f6);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.category-card:hover {
  border-color: var(--category-color, #3b82f6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-card:hover::before {
  opacity: 1;
}

.category-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.category-info {
  width: 100%;
}

.category-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  line-height: 1.2;
}

.category-count {
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 8px;
  display: inline-block;
  font-weight: 500;
}

/* 🛠️ 工具列表样式 */
.tools-section {
  max-height: 300px;
  overflow-y: auto;
}

.tools-list {
  padding: 8px;
}

.tool-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-item:last-child {
  margin-bottom: 0;
}

.tool-item:hover:not(.disabled) {
  border-color: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.tool-item.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f8fafc;
}

.tool-item .tool-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tool-content {
  flex: 1;
  min-width: 0;
}

.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tool-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tool-source {
  font-size: 10px;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.disabled-badge {
  font-size: 10px;
  background: #fef2f2;
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.tool-description {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tool-tag {
  font-size: 10px;
  color: #3b82f6;
  background: #eff6ff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #dbeafe;
  font-weight: 500;
}

/* ⏳ 加载和空状态 */
.loading-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 20px;
  color: #64748b;
  text-align: center;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.empty-icon {
  font-size: 32px;
  opacity: 0.5;
}

.empty-message {
  font-size: 14px;
  color: #94a3b8;
}

/* 📱 响应式设计 */
@media (max-width: 768px) {
  .modern-dropdown {
    width: 320px;
    max-height: 380px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    padding: 12px;
  }
  
  .category-card {
    padding: 12px 8px;
  }
  
  .category-icon {
    font-size: 20px;
  }
  
  .category-name {
    font-size: 12px;
  }
  
  .search-section {
    padding: 12px;
  }
  
  .section-header {
    padding: 12px;
  }
  
  .tools-list {
    padding: 6px;
  }
  
  .tool-item {
    padding: 10px;
  }
}

/* 🎯 聚焦状态和可访问性 */
.tool-category-selector:focus-within {
  outline: none;
}

.category-card:focus,
.tool-item:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* 🌙 深色模式支持（可选） */
@media (prefers-color-scheme: dark) {
  .modern-selector,
  .modern-dropdown {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
  }
  
  .search-section {
    background: #334155;
    border-color: #475569;
  }
  
  .search-input {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
  }
  
  .category-card,
  .tool-item {
    background: #1e293b;
    border-color: #475569;
  }
  
  .tool-name,
  .category-name {
    color: #e2e8f0;
  }
  
  .tool-description {
    color: #94a3b8;
  }
} 